/*
 * author      : 吴中勤 
 * date        : 2018/8/16
 * description : moby会员 - sap BP之间的关系
 */

package com.deepexi.adapter.converter.sap.fund;

import com.deepexi.adapter.common.BaseDto;
import com.google.gson.annotations.SerializedName;

import java.util.Date;

public class SapAdapterFund extends BaseDto {
    private static final int REFUND_FLAG_YES = 1;
    private static final int REFUND_FLAG_NO = 0;

    // 1=订金, 2=定金, 3=尾款(分期首付), 4=银行收款, 5=全部尾款
    private static final String FUND_TYPE_DEPOSIT = "01";
    private static final String FUND_TYPE_EARNEST = "02";
    private static final String FUND_TYPE_DOWN_PAYMENT = "03";
    private static final String FUND_TYPE_FINAL_PAYMENT = "05";

    private String shopCode;

    @SerializedName("tradeOrderId")
    private String mobyOrderId;
    private String memberId;
    private String payMoney;
    private String fundType;
    private String payChannel;
    private String paidAt;

    @SerializedName("payOrderId")
    private String payOrderId;
    private String sapReceiptNo;                // sap会计凭证号

    private int id;
    private Date createdAt = new Date();
    private Date updatedAt;
    private String operatorId;

    // 与退款相关的记录
    private int refundFlag = REFUND_FLAG_NO;     // 是否退款 1=yes, 0=false
    private String refundAt;
    private String refundMoney;

    public boolean isRefund() {
        return REFUND_FLAG_YES == refundFlag;
    }

    // 是否参与结算
    public boolean isTakePartInBilling() {
        return FUND_TYPE_DEPOSIT.equals(fundType)
                || FUND_TYPE_EARNEST.equals(fundType)
                || FUND_TYPE_DOWN_PAYMENT.equals(fundType);
    }

    public void refundYes() {
        this.refundFlag = REFUND_FLAG_YES;
    }

    // ====== set && get ======

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public int getRefundFlag() {
        return refundFlag;
    }

    public void setRefundFlag(int refundFlag) {
        this.refundFlag = refundFlag;
    }

    public String getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(String operatorId) {
        this.operatorId = operatorId;
    }

    public String getRefundAt() {
        return refundAt;
    }

    public void setRefundAt(String refundAt) {
        this.refundAt = refundAt;
    }

    public String getRefundMoney() {
        return refundMoney;
    }

    public void setRefundMoney(String refundMoney) {
        this.refundMoney = refundMoney;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public SapAdapterFund setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
        return this;
    }

    public String getShopCode() {
        return shopCode;
    }

    public SapAdapterFund setShopCode(String shopCode) {
        this.shopCode = shopCode;
        return this;
    }

    public String getMobyOrderId() {
        return mobyOrderId;
    }

    public void setMobyOrderId(String mobyOrderId) {
        this.mobyOrderId = mobyOrderId;
    }

    public String getMemberId() {
        return memberId;
    }

    public SapAdapterFund setMemberId(String memberId) {
        this.memberId = memberId;
        return this;
    }

    public String getPayMoney() {
        return payMoney;
    }

    public SapAdapterFund setPayMoney(String payMoney) {
        this.payMoney = payMoney;
        return this;
    }

    public String getFundType() {
        return fundType;
    }

    public SapAdapterFund setFundType(String fundType) {
        this.fundType = fundType;
        return this;
    }

    public String getPayChannel() {
        return payChannel;
    }

    public SapAdapterFund setPayChannel(String payChannel) {
        this.payChannel = payChannel;
        return this;
    }

    public String getPaidAt() {
        return paidAt;
    }

    public SapAdapterFund setPaidAt(String paidAt) {
        this.paidAt = paidAt;
        return this;
    }

    public String getPayOrderId() {
        return payOrderId;
    }

    public SapAdapterFund setPayOrderId(String payOrderId) {
        this.payOrderId = payOrderId;
        return this;
    }

    public String getSapReceiptNo() {
        return sapReceiptNo;
    }

    public SapAdapterFund setSapReceiptNo(String sapReceiptNo) {
        this.sapReceiptNo = sapReceiptNo;
        return this;
    }
}
